import { ApiProperty, IntersectionType, PartialType } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import {
  ArrayMaxSize,
  ArrayMinSize,
  ArrayNotEmpty,
  IsBoolean,
  IsEmail,
  IsIn,
  IsInt,
  IsNumber,
  IsOptional,
  IsString,
  Matches,
  MaxLength,
  MinLength,
  ValidateIf,
} from 'class-validator';
import { isEmpty } from 'lodash';
import { TestVarStatusEnum } from '../../../../constants/bussiness.enum';

import { PagerDto } from '~/common/dto/pager.dto';

export class VarTestAddDto {
  @ApiProperty({ description: '字符串变量' })
  @IsOptional()
  @IsString()
  varString?: string;

  @ApiProperty({ description: '布尔变量' })
  @IsOptional()
  @IsBoolean()
  varBool?: string;

  @ApiProperty({ description: '数值变量' })
  @IsOptional()
  @IsNumber()
  varNumber?: number;

  @ApiProperty({ description: '字符串数组' })
  @IsOptional()
  @IsString()
  varStringArray?: string;

  @ApiProperty({ description: '数值数组' })
  @IsOptional()
  @IsNumber()
  varNumberArray?: number;

  @ApiProperty({ description: '枚举' })
  @IsOptional()
  @IsString()
  varEnumStatus?: TestVarStatusEnum;
}

export class VarTestUpdateDto extends PartialType(VarTestAddDto) {}

export class VarTestQueryDto extends IntersectionType(
  PagerDto<VarTestAddDto>,
  PartialType(VarTestAddDto)
) {
  @ApiProperty({ description: '关键字' })
  @IsOptional()
  @IsString()
  searchValue?: string;
}
